home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / doodle_d.swf / scripts / DefineSprite_46_en5 / frame_1 / DoAction.as
Text File  |  2013-04-24  |  1KB  |  54 lines

  1. function onEnterFrame()
  2. {
  3.    if(_root.shieldMC.hitTest(_X,_Y,true) && _root.shieldLevel >= 2)
  4.    {
  5.       dx = 0;
  6.       dy = 0;
  7.    }
  8.    _X = _X + dx;
  9.    _Y = _Y + dy;
  10.    if(_Y > 880 || _Y < 0)
  11.    {
  12.       dy *= -1;
  13.       _Y = _Y + dy * 2;
  14.    }
  15.    if(_X < 0 || _X > 640)
  16.    {
  17.       dx *= -1;
  18.       _X = _X + dx * 2;
  19.    }
  20.    timer++;
  21.    if(timer > 30)
  22.    {
  23.       timer = 0;
  24.       dx *= -1;
  25.    }
  26.    if(this.hitTest(_root.ship))
  27.    {
  28.       depth = _root.getNextHighestDepth();
  29.       _root.attachMovie("exp","exp" + depth,depth);
  30.       exp = eval("_root.exp" + depth);
  31.       exp._x = _X;
  32.       exp._y = _Y;
  33.       _root.death();
  34.       _root.eAmount--;
  35.       this.removeMovieClip();
  36.    }
  37.    if(h <= 0)
  38.    {
  39.       _root.eAmount--;
  40.       _root.points += 60;
  41.       _root.eD = _root.eD + 1;
  42.       depth = _root.getNextHighestDepth();
  43.       _root.attachMovie("exp","exp" + depth,depth);
  44.       exp = eval("_root.exp" + depth);
  45.       exp._x = _X;
  46.       exp._y = _Y;
  47.       this.removeMovieClip();
  48.    }
  49. }
  50. dx = Math.random() * 2 + 2;
  51. dy = (Math.random() * 2 + 2) * -1;
  52. h = 10;
  53. timer = Math.random() * 30;
  54.